/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package quanlynhatre.Model;

/**
 *
 * @author VOTHUY
 */
public class DiaChi {
    
    protected String SoNha;
    protected String TenDuong;
    protected String TinhTP;
    
    public DiaChi()
    {
    }
    
    public DiaChi(String sn,String td,String tp)
    {
        this.SoNha = sn;
        this.TenDuong = td;
        this.TinhTP = tp;
    }
    
    public DiaChi New()
    {
        DiaChi dc = new DiaChi();
        dc.SoNha = "";
        dc.TenDuong = "";
        dc.TinhTP = "";
        return dc;
    }
    
    public String getSoNha()
    {
        return SoNha;
    }
    
    public boolean setSoNha(String sn)
    {
        if ( sn.length() == 0 )
            javax.swing.JOptionPane.showMessageDialog(null, "Gia tri khong duoc phep de trong","Error", javax.swing.JOptionPane.WARNING_MESSAGE);
        else if ( sn.length() > 50 )
            javax.swing.JOptionPane.showMessageDialog(null, "Gia tri khong duoc phep lon hon 50 ky tu","Error", javax.swing.JOptionPane.WARNING_MESSAGE);
        else
        {
            this.SoNha = sn;
            return true;
        }
        return false;
   
    }
    
    public String getTenDuong()
    {
        return TenDuong;
    }
    
    public boolean setTenDuong(String value)
    {
        if ( value.length() == 0 )
            javax.swing.JOptionPane.showMessageDialog(null, "Ten duong khong duoc phep de trong","Error", javax.swing.JOptionPane.WARNING_MESSAGE);
        else if ( value.length() > 50 )
            javax.swing.JOptionPane.showMessageDialog(null, "Ten duong khong duoc phep lon hon 50 ky tu","Error", javax.swing.JOptionPane.WARNING_MESSAGE);
        else
        {
            this.TenDuong = value;
            return true;
        }
        return false;
    }
    
    public String getTinhTP()
    {
        return TinhTP;
    }
    
    public boolean setTinhTP(String value)
    {
        if ( value.length() == 0 )
            javax.swing.JOptionPane.showMessageDialog(null, "Tinh thanh pho khong duoc phep de trong","Error", javax.swing.JOptionPane.WARNING_MESSAGE);
        else if ( value.length() > 50 )
            javax.swing.JOptionPane.showMessageDialog(null, "Tinh thanh pho khong duoc phep lon hon 50 ky tu","Error", javax.swing.JOptionPane.WARNING_MESSAGE);
        else
        {
            this.TinhTP = value;
            return true;
        }
        return false;
    }
}
